<?php
$baseThemeUrl = Yii::app()->theme->baseUrl;
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($baseThemeUrl . '/js/jquery.validateAjax.js');
Util::tsRegisterAssetJs('form_wizard.js');
?>
<div class="row-fluid">
    
    <div id="pills" class="custom-wizard-pills">
        <ul class="nav nav-pills">
            <li id="liCuenta" class="active"><a id ="act_cuenta" href="#tab_cuenta" data-toggle="tab">Paso 1: Datos Cuenta</a></li>
            <li id='liMedio' class="disabled" ><a id ="act_medio" href="#tab_medios" data-toggle="e">Paso 2: Medios y direcciones</a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane active" id="tab_cuenta">
                <?php
                $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
                    'id' => 'cuenta-form',
                    'type' => 'horizontal',
                    'enableAjaxValidation' => true,
                    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
                    'enableClientValidation' => false,
                ));
                ?>
                <div class="span8">
                    <div class="widget orange">
                        <div class="widget-title">
                            <h4><i class="icon-briefcase"></i> <?php echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . Cuenta::label(); ?></h4>
                            <span class="tools">
                                <a href="javascript:;" class="icon-chevron-down"></a>
                                <!--a href="javascript:;" class="icon-remove"></a-->
                            </span>
                        </div>
                        <div class="widget-body">

                            <p class="note"><?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span> <?php echo Yii::t('AweCrud.app', 'are required') ?>.</p>
                            <?php echo $form->textFieldRow($model, 'nombre', array('maxlength' => 64, 'class' => 'span10')) ?>
                            <?php echo $form->textFieldRow($model, 'razon_social', array('maxlength' => 64, 'class' => 'span10')) ?>
                            <?php echo $form->textFieldRow($model, 'documento', array('maxlength' => 20, 'data-mask' => '00000000000000', 'class' => 'span6')) ?>
                            <?php echo $form->dropDownListRow($model, 'industria_id', CHtml::listData(Industria::model()->orden()->findAll(), 'id', Industria::representingColumn()), array('empty' => '- Seleccione -', 'class' => 'span6 fix')) ?>
                            <?php echo $form->textFieldRow($model, 'empleados', array('class' => 'span4', 'data-mask' => '000000000')) ?>
                            <?php echo $form->textFieldRow($model, 'ingresos_anuales', array('class' => 'span4 money')) ?>
                            <?php echo $form->dropDownListRow($model, 'tipo', $model->tipoOpciones, array('empty' => '- Seleccione -', 'class' => 'span6 fix')) ?>
                            <?php echo $form->textFieldRow($model, 'website', array('maxlength' => 255, 'class' => 'span6')) ?>
                            <?php echo $form->textAreaRow($model, 'descripcion', array('rows' => 3, 'class' => 'span10')) ?>
                            <div class="form-actions">
                                <div class="form-actions-float">
                                    <?php
                                    $this->widget('bootstrap.widgets.TbButton', array(
//                                        'buttonType' => 'submit',
                                        'type' => 'success',
                                        'icon' => 'ok',
                                        'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                                        'htmlOptions' => array(
                                            'onClick' => 'js:save("#cuenta-form")')
                                    ));
                                    ?>
                                    <?php
                                    $this->widget('bootstrap.widgets.TbButton', array(
                                        'icon' => 'remove',
                                        'label' => Yii::t('AweCrud.app', 'Cancel'),
                                        'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
                                    ));
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <?php if ($grupos): ?>
                        <div class="widget green">
                            <div class="widget-title">
                                <h4><i class="icon-archive"></i> Grupos</h4>
                                <span class="tools">
                                    <a href="javascript:;" class="icon-chevron-down"></a>
                                    <!--a href="javascript:;" class="icon-remove"></a-->
                                </span>
                            </div>
                            <div class="widget-body">
                                <div class="check-box-list">
                                    <?php echo $form->checkBoxList($model, 'grupos', CHtml::listData($grupos, 'id', 'nombre'), array_map('AweHtml::getPrimaryKey', $model->grupos)); ?>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>

                    <div class="widget">
                        <div class="widget-title">
                            <h4><i class="icon-lock"></i> Permisos</h4>
                            <span class="tools">
                                <a href="javascript:;" class="icon-chevron-down"></a>
                                <!--a href="javascript:;" class="icon-remove"></a-->
                            </span>
                        </div>
                        <div class="widget-body permisos">
                            <?php echo $form->dropDownListRow($model, 'owner_id', CHtml::listData(Yii::app()->user->um->listUsers(), 'iduser', 'username'), array('empty' => '- Seleccione -', 'class' => 'span12 fix')) ?>
                            <div class="radio-list">
                                <?php echo $form->radioButtonListRow($model, 'permisos', $model->permisosOpciones) ?>
                            </div>
                        </div>
                    </div>
                </div>

                <?php $this->endWidget(); ?>
            </div>
            <div class="tab-pane" id="tab_medios">
                <div class="row-fluid">
                    <div class="offset10">
                        <a id="btn_finalizar" class="btn  btn-info" type="button"> Finalizar </a>
                    </div>
                    <div class="space15"></div>
                </div>
                <div class="row-fluid">
                    <?php $this->renderPartial('steps/_direcciones', array('model' => $model)) ?>
                </div>
                <div class="row-fluid">
                    <div class="span6">
                        <?php $this->renderPartial('steps/_emails', array('model' => $model)) ?>
                    </div>
                    <div class="span6">
                        <?php $this->renderPartial('steps/_telefonos', array('model' => $model)) ?>
                    </div> 
                </div>
                <div class="row-fluid">
                    <div class="span6">
                        <?php $this->renderPartial('steps/_redes_sociales', array('model' => $model)) ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
